<?php

class Db_Tables_BjmMembersLinkType extends Zend_Db_Table
{
    protected $_name = 'bjm_members_link_type';
	var $member_id;
	
	function GetTypesId()
	{
		$result  = array();
		
		if($this->member_id)
		{
			$rows = $this->fetchAll("member_id=".intval($this->member_id));
			$rows = $rows->toArray();
			
			if(count($rows))
			{
				foreach($rows as $row)
				{
					$result[] = $row['mtid'];
				}
			}
		}
		
		return $result;
	}
	
	function GetDefaultId()
	{
		$result = NULL;
		
		if($this->member_id)
		{
			$row = $this->fetchRow("member_id = ".intval($this->member_id)." and type_name='默认' and status = 1");
			
			if($row)
			{
				$result = $row['mtid'];
			}
		}
		
		return $result;
	}
}